// 笔试强训：chika和蜜柑

#include <atomic>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct Compare
{
    bool operator()(const pair<int, int>& p1, const pair<int, int>& p2)
    {
        if(p1.first > p2.first)
            return true;
        else if(p1.first == p2.first)
            return p1.second < p2.second;
        
        return false;
    }
};

int main() {
    int n = 0, k = 0;
    cin >> n >> k;
    vector<pair<int, int>> v(n);
    for(int i = 0; i < n; i++){cin >> v[i].second;}
    for(int i = 0; i < n; i++){cin >> v[i].first;}
    sort(v.begin(), v.end(), Compare());
    long long sweet = 0, acid = 0;
    for(int i = 0; i < k; i++)
    {
        sweet += v[i].first;
        acid += v[i].second;
    }
    cout << acid << " " << sweet << endl;
}